var a = getApp(), t = a.globalData.host, e = a.globalData.ihost, s = require("../../utils/network.js");

Page({
    data: {
        host: t,
        ihost: e,
        navData: null,
        userData: {},
        hisstar: 0,
        nowstar: 0,
        hasMore: !0,
        pageCurrent: 1,
        pageSize: 30,
        list: [],
        showPage: 0
    },
    onLoad: function(t) {
        this.setData({
            userData: a.data.loginInfo,
            navData: {
                Title: "心愿榜",
                backColor: "#fff",
                ihost: e,
                showBack: 1,
                showHome: 0,
                toRight: 100,
                navHeight: a.globalData.navHeight
            }
        }), this.getList();
    },
    onShow: function() {},
    loadMore: function() {
        if (!this.data.hasMore) return wx.showToast({
            title: "已经到底了",
            icon: "loading",
            duration: 500
        }), !1;
        this.getList();
    },
    getList: function() {
        var t = this;
        a.isLogin() ? s.request({
            url: e + "/BLindBoxSel.asmx/GetWishValue",
            data: {
                UserName: t.data.userData.UserName,
                token: t.data.userData.token,
                pageCurrent: t.data.pageCurrent,
                pageSize: t.data.pageSize
            },
            method: "GET",
            header: {
                "content-type": "application/text"
            },
            success: function(a) {
                if (a.data.success) {
                    debugger;
                    var e = a.data.lstInfo, s = t.data.list.concat(e);
                    t.setData({
                        hisstar: a.data.Info.AllWishValue,
                        nowstar: a.data.Info.WeekWishValue,
                        list: s,
                        pageCurrent: t.data.pageCurrent + 1,
                        hasMore: a.data.hasMore,
                        showPage: 1
                    });
                }
            }
        }) : wx.showModal({
            title: "提示",
            content: "获取用户信息失败",
            showCancel: !1
        });
    },
    goBack: function() {
        wx.navigateBack({});
    }
});